package com.jfree.feign;

import com.jfree.entity.general.User;
import com.jfree.feign.fallbackFactory.ServiceApiFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@SuppressWarnings({"ALL", "AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc"})
@FeignClient(value = "client-1", fallbackFactory = ServiceApiFeignFallbackFactory.class)
public interface ServiceApiFeign {

    String SERVER_NAME = "/client-1";

    @PostMapping(value = SERVER_NAME + "/user")
    User user(@RequestBody User user);

    @SuppressWarnings("AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc")
    @RequestMapping(value = SERVER_NAME + "/getException", method = RequestMethod.GET)
    String getException(@RequestParam("id") Integer id);

    @GetMapping(value = SERVER_NAME + "/test")
    String test(@RequestParam("id") Integer id);

    @GetMapping(value = SERVER_NAME + "/test1")
    String test1(@RequestParam("id") Integer id);

    @GetMapping(value = SERVER_NAME + "/test2/{id}")
    String test2(@PathVariable("id") Integer id);

    @RequestMapping(value = SERVER_NAME + "/test3/{id}", method = RequestMethod.GET)
    String test3(@PathVariable("id") Integer id);

    @PostMapping(value = SERVER_NAME + "/test4")
    User test4(@RequestBody User user);

    @GetMapping(SERVER_NAME + "/test5")
    User test5(User user);  //请求不报错，但user数据丢失
}
